package tk3.project.uploadservice;
import java.io.Serializable;
import java.util.Date;
import java.util.Vector;


public class Message implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 3779202885314576789L;
	private byte type;
	private int acks, radius, shareDuration;
	private double lon,lat;
	private String stream,pass;
	private Vector<Picture> pics;
	private Date date;
	
	/**
	 * Wrapper class for sending Pictures
	 * @param pictures - pictures to be sent
	 */
	public Message(Vector<Picture> pictures){
		pics=pictures;
		for(Picture picture : pics){
			picture.loadPicture();
		}
		type=1;
	}
	
	/**
	 * Wrapper for sending ACKs
	 * @param acks - how many pictures should be ACKed
	 */
	public Message(int acks){
		this.acks=acks;
		type=2;
	}
	
	/**
	 * Wrapper for pulling pictures from the server with GPS position
	 * @param radius
	 * @param lon
	 * @param lat
	 * @param date - date of the newest picture received by the client
	 */
	public Message(int radius, double lon, double lat, Date date) {
		type=3;
		this.radius = radius;
		this.lon = lon;
		this.lat = lat;
		this.date=date;
	}
	/**
	 * Wrapper for pulling pictures from the server with a specified Stream name
	 * @param stream
	 * @param pass
	 * @param date
	 */
	public Message(String stream, String pass,Date date) {
		this.stream = stream;
		this.pass = pass;
		this.date=date;
		type=4;
	}
	public byte getType() {
		return type;
	}
	public int getAcks() {
		return acks;
	}
	public int getRadius() {
		return radius;
	}
	public int getShareDuration() {
		return shareDuration;
	}
	public double getLon() {
		return lon;
	}
	public double getLat() {
		return lat;
	}
	public String getStream() {
		return stream;
	}
	public String getPassword() {
		return pass;
	}
	public Vector<Picture> getPictures() {
		return pics;
	}
	
	
	public boolean isSubmitPictures(){
		return type==1;
	}
	
	public boolean isACK(){
		return type==2;
	}
	public boolean isGetPicturesGPS(){
		return type==3;
	}
	public boolean isGetPicturesStream(){
		return type==4;
	}
	public Date getDate() {
		return date;
	}
	
	

}
